#include <bits/stdc++.h>
using namespace std;
const int N = 500+10, INF = 0x3f3f3f3f;
int n, b[N], d[N][N];
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        int a; cin >> a;
        ans += a;
    }
    for (int i = 1; i <= n; ++i) {
        cin >> b[i];
    }
    for (int l = 1; l <= n; ++l) {
        for (int i = 1, j=i+l-1; i <= n && j<=n; ++i,++j) {
            if(l == 1) {d[i][i] = b[i-1] + b[i+1]; continue;}
            for (int k = i; k <= j; ++k) {
                int t = d[i][k-1] + d[k+1][j] + b[i-1] + b[j+1];
                if(!d[i][j]) d[i][j] = t;
                else d[i][j] = min(d[i][j], t);
            }
        }
    }
    cout << ans + d[1][n];
    return 0;
}